06. A Note About For-In Loops
For-In Loops
Now that you've learned about for-in
loops, it's time to stop using them. No, seriously. for-in
loops are considered to be general bad practice when writing JavaScript because it has some inconsistent behavior with arrays and objects. Check out these links for more:
- http://stackoverflow.com/questions/500504/why-is-using-for-in-with-array-iteration-a-bad-idea
- http://stackoverflow.com/questions/4261051/javascript-why-for-in-is-a-bad-practice
- https://websanova.com/blog/javascript/why-javascript-for-in-loops-are-bad
For the Online Resume project, you will be asked to demonstrate the current best practices and should not use any for-in
loops. Please use either a standard for
loop or the forEach
loop instead.